<%-- 
    Document   : contact
    Created on : Mar 23, 2011, 7:14:56 PM
    Author     : Nguyen Hung
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">

<%@include file="WEB-INF/jspf/header.jspf"%>
<script type="text/javascript">

        function clearTextArea() {
        document.getElementById("content").value=" ";

        function checkName(){

        var client = document.getElementById("fullname");
        var errorName = document.getElementById("errorName");
        var isLetters = /^[a-z A-Z]+$/;

        if(client.value==""){
             errorName.innerHTML = " Vui lòng nhập đúng tên. "
        }else{
            errorName.innerHTML="";
        }
        }
        function checkEmail(){
                 var email = document.getElementById("email");
                 var errEm = document.getElementById("errorEmail");
                 var isEmail = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/;

                 if(email.value.search(isEmail)){
                     errEm.innerHTML = "Địa chỉ Email không xác thực.";
                 }
                 else{
                     errEm.innerHTML = "  ";
                 }
             }
        }

</script>
  
        <%
        request.setCharacterEncoding("utf-8");
          //  String fullnameError = (String) request.getAttribute("fullnameError");
          //  String emailError = (String) request.getAttribute("emailError");
          //  String fullnameText= "(*)";
        //    String emailText = "(*)";
       //     if(fullnameError != null)
        //        fullnameText = fullnameError;
        //    if(emailError != null)
          //      emailText = emailError;


        %>
        
       
        <div class="box_header"></div>
        <h4>Liên hệ với công ty:</h4>
        <div class="box_center">
        <form action="ContactServlet" method="POST" name="contactForm">
            <table>
                <tr>
                    <td>Họ Và Tên</td>
                    <td><input type="text" name="fullname"></td>
                    <td>
                        <span id ="errorName">(*)</span>
                    </td>
                </tr>
                <tr>
                    <td>Địa Chỉ Email</td>
                    <td><input type="text" name="email" onclick="checkName()"/></td>
                    <td><span id ="errorEmail">(*)</span></td>
                </tr>
                <tr> <textarea onclick="clearTextArea(this)" name="content" id="content" cols="45" rows="5">Nhập Nôi Dung</textarea><br></tr>
                
                <tr><input type="submit" value ="Gửi câu hỏi" onsubmit="checkEmail()"/></tr>
            </table>
        </form>
        </div>
        
  <%@include file="WEB-INF/jspf/footer.jspf" %>
